import request from "./request";
import type { IAnyObject } from "./types";

class Http {
  get<T>(url: string, data: IAnyObject = {}) {
    return request<T>({
      url,
      data,
      method: "GET",
    });
  }
  post<T>(url: string, data: IAnyObject = {}) {
    return request<T>({
      url,
      data,
      method: "POST",
    });
  }
  put<T>(url: string, data: IAnyObject = {}) {
    return request<T>({
      url,
      data,
      method: "PUT",
    });
  }
  delete<T>(url: string, data: IAnyObject = {}) {
    return request<T>({
      url,
      data,
      method: "DELETE",
    });
  }
}

export const http = new Http();
